<html>
      <meta charset='utf-8' />
      <head>
            <script src='http://code.jquery.com/jquery.min.js'></script>
            <script src='./jquery-validator.js'></script>
            <script type="text/javascript">
              
            $(function(){
                $('#submit').click(function(){
                    //add Validators
                    $.Validators.reset();
                    $("input").each(function(){
                        $(this).addValidator("require",$(this).siblings("span").html());
                    });

                    $('input[name=identify]').addValidator("id",$('input[name=identify]').val());

                    //使用内置验证器
                    /** addValidator(name,words) 为调用者添加一个名为name的验证器,主语为words */
                    $('#account').addValidator('id','身份证');
                    $('#mail').addValidator('require','邮箱').addValidator('email','邮箱');

                    //构造一个验证器使邮箱报错
                    /** 自定义验证器只需要实现一个json对象即可 **/
                    var myVal =  {'name':'3digits','regex':/^\w{3}$/,'words':'不是三位的字符'};
                    $('#mail').addValidator(myVal,"邮箱");

                    //最后调用验证
                    if(!$.Validators.validate()){
                        return false;
                    }
                });

                      
              });
            </script>
      </head>     
      <body>
        <form>
                  <div>
                      <span>身份证</span>      <input name='identify' id='account'  />  <!--身份证-->
                  </div>

                  <div>
                      <span>邮箱</span>  <input id="mail" > <!--邮箱-->
                  </div>
            <input type="button" value="提交" id="submit"/>
        </form>

      </body>
</html>